/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package digitshoplogic;

import Entities.*;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Date;

/**
 *
 * @author james
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
           //
//            Stock_item  item = Stock_item.GetStockItemByUPC(1);
//            item.outputString();
//            item.UPC = 9;
//            item.name = "item7";
           // Stock_item.AddStockItemByObj(item);

    //        Customer customer = Customer.getCustomerByCardNo( 2);

           // customer.cardNo = customer.cardNo+1;
           // customer.phoneNo = "phone3";
            //Customer.addCustomerByObj(customer);
            //Customer.deleteCustomerByNo(3);

          //  customer.password = "new_pass";
          //  customer.address = "new addr";
           // Customer.updateCustomerByObj(customer);

//            Store s = Store.getStoreByID(10004);
//            //s.storeId = 10002;
//            //Store.addStoreByObj(s);
//           // Store.deleteStoreByID(10003);
//            s.name = "new name";
//            s.address = "new addr";
//            Store.updateStoreByObj(s);
//            Employee emp = Employee.getEmployeeByemployeeId(1);
//            emp.employeeId = 5;
//           emp.name = "name5";
         //  Employee.addEmployeeByObj(emp);
          // Employee.deleteEmployeeByID(5);
         //  emp = Employee.getEmployeeByemployeeId(5);
          // emp.employeeId = 6;
//           emp.name = "name6";
//           Employee.updateEmployeeByObj(emp);

//           Terminal t = Terminal.getTerminalByID(1);
//           t.terminalId = 2;
         //  Terminal.addTerminalByObj(t);
//           t = Terminal.getTerminalByID(2);
//           t.storeId = 10002;
//           Terminal.updateTerminalByObj(t);
//           Terminal.deleteTerminalByID(2);

        //   Category cat = Category.getCategoryByID(1);
//           cat.categoryId = 2;
//
//           cat.cateName = "my name2";
        //   Category.addCategoryByObj(cat);
//           cat = Category.getCategoryByID(2);
//           cat.cateName = "xxxx";
//           cat.parentId = 1;
//           Category.updateCategoryByObj(cat);
//
       //    Category.deleteCategoryByID(2);

         //  Pickup p = Pickup.createPickup(12311);
       //    Pickup.deletePickupByID(178780);
         //   Pickup p1 = Pickup.getPickupByID(178678);

            Discount_rule rule = Discount_rule.getDiscountRuleByID(1);
            //rule.ruleId = 10;
          //  Discount_rule.addDiscountRuleByObj(rule);
            Discount_rule.deleteDiscountRuleByID(6);
            rule = Discount_rule.getDiscountRuleByID(7);
            rule.percentage = new BigDecimal(37);
            rule.count = 1;
            rule.other_count = 2;
            Discount_rule.updateDiscountRuleByObj(rule);

//            Carriage_rate rate = Carriage_rate.getCarriageRateByID(1);
//            rate.classId = 11;
//            Carriage_rate.addCarriageRateByObj(rate);
//            rate = Carriage_rate.getCarriageRateByID(7);
//            rate.price = new BigDecimal(100);
//            rate.days = 1;
//            rate.updateCarriageRateByObj(rate);
//            Carriage_rate.deleteCarriageRateByID(9);
           //Date from_date = new Date();
           // Date f = DateUtils.now();

            java.util.Date dtNow = new java.util.Date();
           java.sql.Date dtToday = new java.sql.Date(dtNow.getYear(), dtNow.getMonth(), dtNow.getDate());
           dtToday.setMonth(8);
           dtToday.setDate(29);
            Discount dis = new Discount (26, 5, dtToday, dtToday);
           //Discount.addDiscountByObj(dis);
          Discount.deleteDiscountByObj(dis);
            

            System.out.println("end");
            
        } catch (SQLException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}
